ARD2  1.00 for Rev B. Hardware
Airbag Reference Demonstrator using MPC5604P
CG147_Diag.h File Reference

Go to the source code of this file.

Defines

#define TRUE   (1u)
#define CLEAR   (0u)
#define BITS_IN_NIBBLE   (4u)
#define BITS_IN_BYTE   (8u)
#define BYTES_IN_16   (2u)
#define BYTES_IN_32   (4u)
#define BIT_DEFINITION
#define BIT0   (1u << 0u)
#define BIT1   (1u << 1u)
#define BIT2   (1u << 2u)
#define BIT3   (1u << 3u)
#define BIT4   (1u << 4u)
#define BIT5   (1u << 5u)
#define BIT6   (1u << 6u)
#define BIT7   (1u << 7u)
#define BIT8   (1u << 8u)
#define BIT9   (1u << 9u)
#define BIT10   (1u << 10)
#define BIT11   (1u << 11)
#define BIT12   (1u << 12)
#define BIT13   (1u << 13)
#define BIT14   (1u << 14)
#define BIT15   (1u << 15)
#define BIT16   (1u << 16)
#define BIT17   (1u << 17)
#define BIT18   (1u << 18)
#define BIT19   (1u << 19)
#define BIT20   (1u << 20)
#define BIT21   (1u << 21)
#define BIT22   (1u << 22)
#define BIT23   (1u << 23)
#define BIT24   (1u << 24)
#define BIT25   (1u << 25)
#define BIT26   (1u << 26)
#define BIT27   (1u << 27)
#define BIT28   (1u << 28)
#define BIT29   (1u << 29)
#define BIT30   (1u << 30)
#define BIT31   (1u << 31)
#define SBC_TEST_VER_CAP_LIMIT_LO   ((uint16_t)(((2.4 - 2.2) / 3.3) * 1024u))
#define SBC_TEST_VER_ESR_LIMIT_LO   ((uint16_t)(((2.4 - 2.4) / 3.3) * 1024u))
#define SBC_TEST_VER_POL_LIMIT_LO   ((uint16_t)(((2.4 - 2.2) / 3.3) * 1024u))
#define SBC_TEST_VER_CAP_LIMIT_HI   ((uint16_t)(((2.4 - 1.0) / 3.3) * 1024u))
#define SBC_TEST_VER_ESR_LIMIT_HI   ((uint16_t)(((2.4 - 1.0) / 3.3) * 1024u))
#define SBC_TEST_VER_POL_LIMIT_HI   ((uint16_t)(((2.4 - 1.0) / 3.3) * 1024u))
#define SBC_TEST_FLM_LEAK_LIMIT_LO   ((uint16_t)(((1.1 * 0.95) / 3.3) * 1024u))
#define SBC_TEST_FLM_LEAK_LIMIT_HI   ((uint16_t)(((1.1 * 1.05) / 3.3) * 1024u))
#define SBC_TEST_FLM_LOWLEAK_LIMIT_LO   ((uint16_t)(((0.38 * 5 * 0.95) / 3.3) * 1024u))
#define SBC_TEST_FLM_LOWLEAK_LIMIT_HI   ((uint16_t)(((0.38 * 5 * 1.05) / 3.3) * 1024u))
#define SBC_SQUIB_RESISTANCE_LIMIT_HI   68u
#define SBC_SQUIB_RESISTANCE_LIMIT_LO   4u
#define SBC_SQREF_RESISTANCE   (68u)
#define SBC_TEST_AINADC_VAS_SET_LIMIT_LO   118u
#define SBC_TEST_AINADC_VAS_SET_LIMIT_HI   140u
#define SBC_TEST_AINADC_REF_BG_LIMIT_LO   123u
#define SBC_TEST_AINADC_REF_BG_LIMIT_HI   132u
#define SBC_TEST_AINADC_REF_BG2_LIMIT_LO   253u
#define SBC_TEST_AINADC_REF_BG2_LIMIT_HI   255u
#define SBC_TEST_AINADC_REF_23BG2_LIMIT_LO   166u
#define SBC_TEST_AINADC_REF_23BG2_LIMIT_HI   174u
#define SBC_TEST_AINADC_AGND_LIMIT_LO   0u
#define SBC_TEST_AINADC_AGND_LIMIT_HI   3u
#define SBC_TEST_AINMUX_NOSWITCHCLOSED_LIMIT_LO   166u
#define SBC_TEST_AINMUX_NOSWITCHCLOSED_LIMIT_HI   174u
#define SBC_TEST_AINMUX_SWITCHGND_LIMIT_LO   0u
#define SBC_TEST_AINMUX_SWITCHGND_LIMIT_HI   8u
#define SBC_TEST_AINMUX_SWITCHAVST33_LIMIT_LO   253u
#define SBC_TEST_AINMUX_SWITCHAVST33_LIMIT_HI   255u
#define SBC_TIMEOUT   0x5000000u
#define SBC_TEST_SCHEDULER_FAILED   0x80000000
#define SBC_TEST_UNEXPECTED_SPI_RESULT   0x40000000
#define SBC_TEST_LO_LIMIT_FAILED   0x20000000
#define SBC_TEST_HI_LIMIT_FAILED   0x10000000
#define SBC_TEST_FLM_RESISTANCE_FAILED   0x08000000
#define SBC_TEST_FLM_LOWLEAK_FAILED   0x04000000
#define SBC_TEST_FLM_LEAK_FAILED   0x02000000
#define SBC_TEST_DIS_ALP_FAILED   0x01000000
#define SBC_TEST_SBC_ADC_FAILED   0x00800000
#define SBC_TEST_SBC_MUX_NOSWITCH_FAILED   0x00400000
#define SBC_TEST_SBC_MUX_SWITCHGND_FAILED   0x00200000
#define SBC_TEST_SBC_MUX_SWITCHAVST33_FAILED   0x00100000
#define SBC_DIAG_CRITICAL_FAILURE

Functions

uint32_t u32fnSBCPerformInitialTestsPOM (const uint8_t u8ERx, const uint8_t u8TestIndex)
 This routine performs initial tests on the SBC regarding POM at startup to guarantee operation.
uint32_t u32fnSBCPerformInitialTestsFLM (const uint16_t cu16SquibMask)
 Automatizes the request of all FLM tests, namely u32fnSBCFLMLeakageMeasP1, u32fnSBCFLMLeakageMeasP2, and u32fnSBCFLMResistanceMeasurement.
uint32_t u32fnSBCFLMLeakageMeasP1 (uint8_t u8IgnitionPin, uint8_t u8LowLeakage)
 This routine performs the Firing Loop Module leakage measurement on ignition pins but doesn't wait for the response, which is calculated within u32fnSBCFLMLeakageMeasP2.
uint32_t u32fnSBCFLMLeakageMeasP2 (uint8_t u8LowLeakage, uint8_t u8Counter, uint16_t *pu16Aout)
 This routine gathers the result of the configuration performed by u32fnSBCFLMLeakageMeasP1, and formats it accordingly.
uint32_t u32fnSBCFLMResistanceMeasurement (const uint8_t u8IgnitionPinHigh, const uint8_t u8IgnitionPinLow, const uint8_t u8Counter)
 This routine performs the Firing Loop Module resistance measurement of squibs.
uint32_t u32fnSBCTestMuxAndADC (uint8_t u8TestIndex)
 Performs one of the tests defined in cau8SBCInitialTestAnaHeadSettings and cau8SBCInitialTestAnaMUXChannel as defined by the passed argument. These tests are meant to verify the integrity of the ADC and Mux within the SBC, and are required to guarantee optimum behavior of the part.
uint8_t u8fnCG147ReadAIn (const uint8_t cu8DSPIInstance1, const uint8_t cu8DSPIInstance2, const uint8_t cu8ChipSelect, const uint8_t cu8Step, const uint8_t cu8CG147Ch, uint16_t *pu16ADCResult, uint32_t *pu32Time)

Variables

const uint8_t cu8SizeOfSBCTests
const uint8_t cu8SizeOfTestAnaHeadSettings
const uint8_t cau8SBCInitialTestAoutRoutesIGL []
const uint8_t cau8SBCInitialTestAoutRoutesIGH []

Detailed Description

Copyright (c) 2011 Freescale Semiconductor Freescale Confidential Proprietary

Author:
Freescale Semiconductor
SASD Automotive
r11515
Version:
Date:
Dec 9, 2011
Warning:
(If needed)

History:


Define Documentation

#define SBC_DIAG_CRITICAL_FAILURE
Value:
(SBC_TEST_SCHEDULER_FAILED | \
                                   SBC_TEST_UNEXPECTED_SPI_RESULT | \
                                   SBC_TEST_DIS_ALP_FAILED | \
                                   SBC_TEST_SBC_ADC_FAILED | \
                                   SBC_TEST_SBC_MUX_NOSWITCH_FAILED | \
                                   SBC_TEST_SBC_MUX_SWITCHGND_FAILED | \
                                   SBC_TEST_SBC_MUX_SWITCHAVST33_FAILED)

A critical failure mask that should force the device into safe mode

#define SBC_TEST_DIS_ALP_FAILED   0x01000000

CG147 error code for having DIS_ALP high

#define SBC_TEST_FLM_LEAK_FAILED   0x02000000

CG147 error code for a failed high-leakage test

#define SBC_TEST_FLM_LOWLEAK_FAILED   0x04000000

CG147 error code for a failed low-leakage test

#define SBC_TEST_FLM_RESISTANCE_FAILED   0x08000000

CG147 error code for a failed resistance test

#define SBC_TEST_HI_LIMIT_FAILED   0x10000000

CG147 error code for a failed higher limit

#define SBC_TEST_LO_LIMIT_FAILED   0x20000000

CG147 error code for a failed lower limit

#define SBC_TEST_SBC_ADC_FAILED   0x00800000

CG147 error code for a failed ADC

#define SBC_TEST_SBC_MUX_NOSWITCH_FAILED   0x00400000

CG147 error code for a failed MUX with no switched inputs

#define SBC_TEST_SBC_MUX_SWITCHAVST33_FAILED   0x00100000

CG147 error code for a failed MUX with switched inputs to VST33

#define SBC_TEST_SBC_MUX_SWITCHGND_FAILED   0x00200000

CG147 error code for a failed MUX with switched inputs to GND

#define SBC_TEST_SCHEDULER_FAILED   0x80000000

CG147 error code for an uncooperative scheduler

#define SBC_TEST_UNEXPECTED_SPI_RESULT   0x40000000

CG147 error code an error response


Function Documentation

uint32_t u32fnSBCFLMLeakageMeasP1 ( uint8_t  u8IgnitionPin,
uint8_t  u8LowLeakage 
)

This routine performs the Firing Loop Module leakage measurement on ignition pins but doesn't wait for the response, which is calculated within u32fnSBCFLMLeakageMeasP2.

Parameters:
u8IgnitionPin,:Squib on which the test is to be performed, as specified in cau8SBCInitialTestAoutRoutesIGH and cau8SBCInitialTestAoutRoutesIGL
u8LowLeakage,:High (CLEAR) leakage or Low (TRUE) leakage detection
Returns:
Zero if no problems, otherwise MAILBOX_IS_BEING_WRITTEN, or MAILBOX_CAPACITY_HAS_BEEN_REACHED;
uint32_t u32fnSBCFLMLeakageMeasP2 ( uint8_t  u8LowLeakage,
uint8_t  u8Counter,
uint16_t *  pu16Aout 
)

This routine gathers the result of the configuration performed by u32fnSBCFLMLeakageMeasP1, and formats it accordingly.

Parameters:
u8LowLeakage,:High (CLEAR) leakage or Low (TRUE) leakage detection
u8Counter,:0 - 11, index for the squib to be tested.
pu16Aout,:Pointer to 16-bit value to hold the test result (for further reference).
Returns:
u32Status: Clear if all ok; SBC_TEST_SCHEDULER_FAILED if there was a problem reading back from the scheduler; SBC_TEST_SBC_ADC_FAILED if the given test instance has failed; SBC_TEST_FLM_LEAK_FAILED if the selected test was high-leakage related and it was failed; SBC_TEST_FLM_LOWLEAK_FAILED if the selected test was low-leakage related and it was failed; All failed status words will contain a flag corresponding to the u8Counter variable passed.
uint32_t u32fnSBCFLMResistanceMeasurement ( const uint8_t  u8IgnitionPinHigh,
const uint8_t  u8IgnitionPinLow,
const uint8_t  u8Counter 
)

This routine performs the Firing Loop Module resistance measurement of squibs.

Parameters:
u8IgnitionPinHigh,:Command for the ignition pin high. Contained within cau8SBCInitialTestAoutRoutesIGH.
u8IgnitionPinLow,:Command for the ignition pin low. Contained within cau8SBCInitialTestAoutRoutesIGL
u8Counter,:0 - 11, index for the squib to be tested.
Returns:
u32Status: Clear if all ok; SBC_TEST_DIS_ALP_FAILED if the ALP pin is high (indicating a faulty watchdog interaction); SBC_TEST_SCHEDULER_FAILED if there was a problem either writing to the scheduler or reading back from it; SBC_TEST_FLM_RESISTANCE_FAILED if the result was outside the pre-established limits. The last two error flags will be accompanied by a u8Counter-relative flag.
uint32_t u32fnSBCPerformInitialTestsFLM ( const uint16_t  cu16SquibMask)

Automatizes the request of all FLM tests, namely u32fnSBCFLMLeakageMeasP1, u32fnSBCFLMLeakageMeasP2, and u32fnSBCFLMResistanceMeasurement.

Parameters:
cu16SquibMask,:Mask list with the squibs to be tested (BIT0 = 1 means squib 0 will be tested, and so on).
Returns:
Zero if no problems; otherwise MAILBOX_IS_BEING_WRITTEN, or MAILBOX_CAPACITY_HAS_BEEN_REACHED; SBC_TEST_SCHEDULER_FAILED if there was a problem reading back from the scheduler; SBC_TEST_SBC_ADC_FAILED if the given test instance has failed; SBC_TEST_FLM_LEAK_FAILED if the selected test was high-leakage related and it was failed; SBC_TEST_FLM_LOWLEAK_FAILED if the selected test was low-leakage related and it was failed; SBC_TEST_FLM_RESISTANCE_FAILED if the resistance was outside the pre-established limits. All failed status words will contain a flag corresponding to the failed squibs.
uint32_t u32fnSBCPerformInitialTestsPOM ( const uint8_t  u8ERx,
const uint8_t  u8TestIndex 
)

This routine performs initial tests on the SBC regarding POM at startup to guarantee operation.

Parameters:
u8ERx,:ERx line to be tested.
u8TestIndex,:Index of the test to be performed, as defined in cau8SBCTests.
Returns:
u32Status: Clear if all ok; SBC_TEST_SCHEDULER_FAILED if there's a problem reading back from SBC; SBC_TEST_UNEXPECTED_SPI_RESULT if the SBC response is not as expected; SBC_TEST_HI_LIMIT_FAILED or SBC_TEST_LO_LIMIT_FAILED (self-explanatory). A flag for each failed ER channel is also added, from BIT0 to BIT5, corresponding to each of the ER channels that were failed somewhere.
uint32_t u32fnSBCTestMuxAndADC ( uint8_t  u8TestIndex)

Performs one of the tests defined in cau8SBCInitialTestAnaHeadSettings and cau8SBCInitialTestAnaMUXChannel as defined by the passed argument. These tests are meant to verify the integrity of the ADC and Mux within the SBC, and are required to guarantee optimum behavior of the part.

Parameters:
u8TestIndex,:Index of test to perform, referring to elements in cau8SBCInitialTestAINADCVoltages
Returns:
u32Status: Clear if all ok; SBC_TEST_SCHEDULER_FAILED if there was a problem either writing to the scheduler or reading back from it; SBC_TEST_SBC_ADC_FAILED if the given test instance has failed.

Variable Documentation

const uint8_t cu8SizeOfSBCTests

As its name states